package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.entity.AfoneshopChannel;
import com.example.demo.mapper.AfoneshopChannelMapper;
import com.example.demo.service.IAfoneshopChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr.We
 * @since 2024-06-21
 */
@Service
public class AfoneshopChannelServiceImpl extends ServiceImpl<AfoneshopChannelMapper, AfoneshopChannel> implements IAfoneshopChannelService {
    @Resource
    private AfoneshopChannelMapper afoneshopChannelMapper;

    @Override
    public AfoneshopChannel queryObject(Integer id) {
        return afoneshopChannelMapper.queryObject(id);
    }

    @Override
    public List<AfoneshopChannel> queryList(Map<String, Object> map) {
        return afoneshopChannelMapper.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return afoneshopChannelMapper.queryTotal(map);
    }

    @Override
    public boolean save(AfoneshopChannel order) {
        if (order.getId() == null){
            afoneshopChannelMapper.insert(order);
            return true;
        }
        return false;
    }


    public void update(AfoneshopChannel order) {
        QueryWrapper<AfoneshopChannel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",order.getId());
        afoneshopChannelMapper.update(queryWrapper);
    }


    public void delete(Integer id) {
        QueryWrapper<AfoneshopChannel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        afoneshopChannelMapper.delete(queryWrapper);
    }


    public void deleteBatch(Integer[] ids) {
            QueryWrapper<AfoneshopChannel> queryWrapper = new QueryWrapper<>();
            queryWrapper.in("id", (Object) ids);
        afoneshopChannelMapper.delete(queryWrapper);
    }
}
